package com.iknow.xmpp.smack.avatar;

import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.provider.PacketExtensionProvider;
import org.xmlpull.v1.XmlPullParser;

public class AvatarMetadataProvider
  implements PacketExtensionProvider
{
  public PacketExtension parseExtension(XmlPullParser paramXmlPullParser)
    throws Exception
  {
    int j;
    AvatarMetadataExtension.Info localInfo;
    int l;
    int i1;
    AvatarMetadataExtension localAvatarMetadataExtension = new AvatarMetadataExtension();
    int i = 0;
    new StringBuilder();
    do
    {
      if (i != 0)
        return localAvatarMetadataExtension;
      j = paramXmlPullParser.next();
      if (j != 2)
        break label237;
    }
    while (!("info".equals(paramXmlPullParser.getName())));
    String str1 = paramXmlPullParser.getAttributeValue(null, "id");
    String str2 = paramXmlPullParser.getAttributeValue(null, "type");
    String str3 = paramXmlPullParser.getAttributeValue(null, "bytes");
    String str4 = paramXmlPullParser.getAttributeValue(null, "height");
    String str5 = paramXmlPullParser.getAttributeValue(null, "width");
    int k = 0;
    if (str3 != null);
    try
    {
      do
      {
        int i2 = Integer.parseInt(str3);
        k = i2;
      }
      while ((k == 0) || (str1 == null) || (str2 == null));
      localInfo = new AvatarMetadataExtension.Info(str1, str2, k);
      localInfo.setUrl(paramXmlPullParser.getAttributeValue(null, "url"));
      l = 0;
      i1 = 0;
      label228: label237: if (str4 != null);
    }
    catch (NumberFormatException localNumberFormatException2)
    {
      try
      {
        while (true)
        {
          do
            while (true)
            {
              l = Integer.parseInt(paramXmlPullParser.getAttributeValue(null, "height"));
              if (str5 != null)
                i1 = Integer.parseInt(paramXmlPullParser.getAttributeValue(null, "width"));
              localInfo.setHeight(l);
              localInfo.setWidth(i1);
              localAvatarMetadataExtension.addInfo(localInfo);
            }
          while ((j != 3) || (!(paramXmlPullParser.getName().equals(localAvatarMetadataExtension.getElementName()))));
          i = 1;
        }
        localNumberFormatException2 = localNumberFormatException2;
      }
      catch (NumberFormatException localNumberFormatException1)
      {
        break label228:
      }
    }
  }
}